#define _CRT_SECURE_NO_WARNINGS
#include <cstddef>
#include <iostream>
using namespace std;

int main() {
    string s1;
    getline(cin, s1);
    size_t i = s1.rfind(' ');
    if (i != string::npos)
    {
        cout << s1.size() - 1 - i << endl;
    }
    else {
        cout << s1.size() << endl;
    }
    return 0;
}